package com.yanqu.road.entity.kuang;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.enums.kuang.eKuangAttributeType;

import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_kuang_user_data", desc = "矿场争夺战用户数据")
public class KuangUserData extends DataObject {

    @FieldTypeAnnotation(desc = "用户ID", select = true, update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "周次id")
    private int weekId;

    @FieldTypeAnnotation(desc = "分组id")
    private int groupId;

    @FieldTypeAnnotation(desc = "轮次天数")
    private int roundDay;

    @FieldTypeAnnotation(desc = "阵营数据")
    private int campId;

    @FieldTypeAnnotation(desc = "装备列表", sqlType = Types.LONGNVARCHAR)
    private Map<Integer, KuangEquipmentData> equipmentDataMap = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "待选择的装备列表", sqlType = Types.LONGNVARCHAR)
    private List<KuangEquipmentData> chooseEquipmentDataList = new ArrayList<>();

    @FieldTypeAnnotation(desc = "剩余抽奖次数")
    private int drawTimes;

    @FieldTypeAnnotation(desc = "本轮额外抽奖次数(废弃)")
    private int extraDrawTimes;

    @FieldTypeAnnotation(desc = "本周累计抽奖次数")
    private int totalDrawTimes;

    @FieldTypeAnnotation(desc = "藏品加成的次数")
    private int curioTimes;

    @FieldTypeAnnotation(desc = "玩家属性", sqlType = Types.LONGNVARCHAR)
    private Map<eKuangAttributeType, Long> attributeMap = new ConcurrentHashMap<>();

    @FieldTypeAnnotation(desc = "上一轮轮战绩")
    private long lastRoundScore;

    public KuangUserData() {

    }

    public int getWeekId() {
        return weekId;
    }

    public void setWeekId(int weekId) {
        if (this.weekId != weekId) {
            this.weekId = weekId;
            setOp(DataStatus.Update);
        }
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            setOp(DataStatus.Update);
        }
    }

    public int getRoundDay() {
        return roundDay;
    }

    public void setRoundDay(int roundDay) {
        if (this.roundDay != roundDay) {
            this.roundDay = roundDay;
            setOp(DataStatus.Update);
        }
    }

    public long getLastRoundScore() {
        return lastRoundScore;
    }

    public void setLastRoundScore(long lastRoundScore) {
        if (this.lastRoundScore != lastRoundScore) {
            this.lastRoundScore = lastRoundScore;
            setOp(DataStatus.Update);
        }
    }

    public int getCampId() {
        return campId;
    }

    public void setCampId(int campId) {
        if (this.campId != campId) {
            this.campId = campId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public int getDrawTimes() {
        return drawTimes;
    }

    public void setDrawTimes(int drawTimes) {
        if (this.drawTimes != drawTimes) {
            this.drawTimes = drawTimes;
            setOp(DataStatus.Update);
        }
    }

    public int getExtraDrawTimes() {
        return extraDrawTimes;
    }

    public void setExtraDrawTimes(int extraDrawTimes) {
        if (this.extraDrawTimes != extraDrawTimes) {
            this.extraDrawTimes = extraDrawTimes;
            setOp(DataStatus.Update);
        }
    }

    public int getTotalDrawTimes() {
        return totalDrawTimes;
    }

    public void setTotalDrawTimes(int totalDrawTimes) {
        if (this.totalDrawTimes != totalDrawTimes) {
            this.totalDrawTimes = totalDrawTimes;
            setOp(DataStatus.Update);
        }
    }

    public Map<Integer, KuangEquipmentData> getEquipmentDataMap() {
        return equipmentDataMap;
    }

    public void setEquipmentDataMap(Map<Integer, KuangEquipmentData> equipmentDataMap) {
        if (null == equipmentDataMap) {
            return;
        }
        if (this.equipmentDataMap == null || !this.equipmentDataMap.equals(equipmentDataMap)) {
            this.equipmentDataMap = equipmentDataMap;
            setOp(DataStatus.Update);
        }
    }

    public List<KuangEquipmentData> getChooseEquipmentDataList() {
        return chooseEquipmentDataList;
    }

    public void setChooseEquipmentDataList(List<KuangEquipmentData> chooseEquipmentDataList) {
        if (null == chooseEquipmentDataList) {
            return;
        }
        if (this.chooseEquipmentDataList == null || !this.chooseEquipmentDataList.equals(chooseEquipmentDataList)) {
            this.chooseEquipmentDataList = chooseEquipmentDataList;
            setOp(DataStatus.Update);
        }
    }

    public Map<eKuangAttributeType, Long> getAttributeMap() {
        return attributeMap;
    }

    public void setAttributeMap(Map<eKuangAttributeType, Long> attributeMap) {
        if (null == attributeMap) {
            return;
        }
        if (this.attributeMap == null || !this.attributeMap.equals(attributeMap)) {
            this.attributeMap = attributeMap;
            setOp(DataStatus.Update);
        }
    }

    public int getCurioTimes() {
        return curioTimes;
    }

    public void setCurioTimes(int curioTimes) {
        if(this.curioTimes != curioTimes) {
            this.curioTimes = curioTimes;
            setUpdateOption();
        }
    }
}
